package com.producer;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * MQ生产者
 * @author IT-GYS
 *
 */
@Component
public class MqProducer 
{
	@Value("${rabbitmq.exchange.topic}")
	String exchangeKey;
	@Value("${rabbitmq.routing.topic}")
	String routingKey;

	@Autowired
	private AmqpTemplate amqpTemplate;
	
	/**
	 * 发送MQ
	 * 根据绑定交换机和路由觉得发那些QUEUE
	 * @param obj
	 */
	public void sendNotification(Object obj)
	{
	    this.amqpTemplate.convertAndSend(exchangeKey,"routing_topic.A",obj);
	}
	
}
